//
//  GameResultController.m
//  ELife
//
//  Created by xiaozhi on 11-5-20.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "GameResultController.h"


@implementation GameResultController
@synthesize titleLabel, msgWebView;

- (void) initResult:(CHARGE_RESULT)result
{
    UILabel *resultTitleLabel = (UILabel *)[self.view viewWithTag:TAG_TITLE_LABEL];

    switch(result) {
            // THIS IS DEFAULT
        case SUCCESSFUL:
            break;
        case FAIL:
            resultTitleLabel.text = CHARGE_FAIL;
            
            [[self.view viewWithTag:TAG_CONTENT_SUC_1_LABEL]removeFromSuperview];
            [[self.view viewWithTag:TAG_CONTENT_SUC_2_LABEL]removeFromSuperview];            
            [[self.view viewWithTag:TAG_CONTENT_SUC_3_LABEL]removeFromSuperview];
            
            UILabel *failLabel = (UILabel *)[self.view viewWithTag:TAG_CONTENT_FAIL_LABEL];
            failLabel.frame = CGRectMake(30, 120, 239, 53);
            [failLabel setHidden:NO];
            break;
    };

}


- (GameResultController *)initWithResult:(CHARGE_RESULT) result
{
    self = [super initWithNibName:@"GameResultController" bundle:nil];
    
    if (self) {
        [self initResult:result];
    }
    
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [[UIColor alloc] 
                                 initWithPatternImage:[UIImage imageNamed:@"bg.png"]];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
